#include "Log.h"

Log::Log( void )
{

}

Log::Log(int occurTime , STATE state, string name , int flag  /*= -1 */ , int flag2 /*= -1 */ )
: state(state) , name(name) , flag(flag) , flag2(flag2) 
{
	OccurTime(occurTime);
}

Log::~Log( void )
{

}

void Log::printResult( ostream& out )
{
	out << OccurTime() << "\t" << name ;
	switch(state)	{
		case ORDER :
			out << " received an order (" << flag << " units)." ;
			break;
		case ARRIVAL :
			out << " arrived at the city.";
			break;
		case MOVEIN :
			out << " moved into the station" ;
			if (flag > 0)
				out << " (" << flag << " delayed)" ;
			out << "." ;
			break;
		case UNLOADANDLOAD :
			out << " loading/unloading done (" << flag << " unloaded, " << flag2 << " loaded).";
			break;
		case LEAVE :
			out << " leaved the city";
			if (flag > 0)
				out << " (" << flag << " delayed)" ;
			out << "." ;
			break;
		case ADDITIONALLOAD :
			out << " loading done for additional order (" << flag << " loaded)" ;
			break;
		case REPAIRING :
			out << " repairing done.";
			break;
	}
	out << endl;
}